//口碑信息
$.ajax({
    type: "post",
    url: studentURL + ':9999/oaSystem/student',
    dataType: "json",
    data: {
        "method": "center"
    },
    success: function (data) {
        console.log(data)
        if (data.code == 200) {
            var list = data.result;
            for (var i = 0; i < list.length; i++) {
                $("<option value=" + list[i].centreid + ">" + list[i].centreName + "</option>").appendTo($('#likeStudy4'));// 校区的
            }
            $("#likeStudy4").change(function () {
                $.ajax({
                    type: "post",
                    url: studentURL + ':9999/oaSystem/student',
                    dataType: "json",
                    data: {
                        "method": "deptment",
                        "centerId": $("#likeStudy4").val()
                    },
                    success: function (data) {
                        console.log(data)
                        if (data.code == 200) {
                            $("#likeStudy5").html("")
                            var list = data.result;
                            for (var i = 0; i < list.length; i++) {
                                $("<option value=" + list[i].deptId + ">" + list[i].deptName + "</option>").appendTo($('#likeStudy5'));//部门的

                            };
                            $("#likeStudy5").change(function () {

                                var Na = $('#likeStudy5').find("option:selected").val();
                                console.log("你好" + Na)
                                $.ajax({
                                    type: "post",
                                    url: studentURL + ':9999/oaSystem/student',
                                    dataType: "json",
                                    data: {
                                        "method": "claInfo",
                                        "classId": Na
                                    },
                                    success: function (data) {
                                        console.log(data)
                                        if (data.code == 200) {
                                            $('#likeStudy6').html("");
                                            $('#likeStudy7').html("");
                                            var list = data.result;
                                            for (var i = 0; i < list.length; i++) {
                                                $("<option value=" + list[i].studentId + ">" + list[i].studentName + "</option>").appendTo($('#likeStudy6')); // 姓名
                                                $("<option value=''>" + list[i].telphone + "</option>").appendTo($('#likeStudy7'));//电话
                                            }

                                        }
                                    },
                                    error: function (xhr, error) {
                                        console.log(error)
                                        console.log(1)
                                    }
                                })
                            })
                        }
                    },
                    error: function (xhr, error) {
                        console.log("2")
                        console.log(error)
                    }
                })
            })

        }

    },
    error: function (xhr, error) {
        console.log(error)
    }


})
// 部门请求
$("#teamN").click(function () {
    var te = $('#likeStudy4').find("option:selected").val();
    $.ajax({
        type: "post",
        url: studentURL + ':9999/oaSystem/student',
        dataType: "json",
        data: {
            "method": "deptment",
            "centerId": te
        },
        success: function (data) {
            console.log(data)
            if (data.code == 200) {
                $("#likeStudy5").html("")
                var list = data.result;
                for (var i = 0; i < list.length; i++) {
                    $("<option value=" + list[i].deptId + ">" + list[i].deptName + "</option>").appendTo($('#likeStudy5'));
                }
                $("#likeStudy5").change(function () {
                    var Na = $('#likeStudy5').find("option:selected").val();

                    console.log(Na)
                    $.ajax({
                        type: "post",
                        url: studentURL + ':9999/oaSystem/student',

                        dataType: "json",
                        data: {
                            "method": "claInfo",
                            "classId": Na
                        },
                        success: function (data) {
                            console.log(data)
                            if (data.code == 200) {
                                $('#likeStudy6').html("");
                                $('#likeStudy7').html("");
                                var list = data.result;
                                for (var i = 0; i < list.length; i++) {
                                    $("<option value=" + list[i].studentId + ">" + list[i].studentName + "</option>").appendTo($('#likeStudy6'));
                                    $("<option value=''>" + list[i].telphone + "</option>").appendTo($('#likeStudy7'));
                                }

                            }
                        },
                        error: function (xhr, error) {
                            console.log(error)
                        }
                    })
                })
            }
        },
        error: function (xhr, error) {
            console.log(error)
        }
    })
})
// 班级请求
$("#classN").click(function () {

    var te = $('#likeStudy4').find("option:selected").val();
    console.log(te)
    $.ajax({
        type: "post",
        url: studentURL + ':9999/oaSystem/student',
        dataType: "json",
        data: {
            "method": "clas",

            "centerId": te
        },
        success: function (data) {
            console.log(data)
            if (data.code == 200) {
                $("#likeStudy5").html("")
                var list = data.result;
                for (var i = 0; i < list.length; i++) {
                    $("<option value=" + list[i].classId + ">" + list[i].className + "</option>").appendTo($('#likeStudy5'));
                }
            }
        },
        error: function (xhr, err) {
            console.log(err)
        }
    })
})